//
//  ImageGridPropertyEntry.m
//  ImageGridCell
//
//  Created by 为为 on 14-7-27.
//  Copyright (c) 2014年 为为. All rights reserved.
//

#define KEY_TITLE	@"title"
#define KEY_DOWNLOADMODE @"downloadMode"
#define KEY_IMAGENAMES @"imageNames"
#define KEY_DELETABLE @"deletable"
#define KEY_IMAGEPATHBASE @"imagePathBase"

#import "ImageGridPropertyEntry.h"

@implementation ImageGridPropertyEntry

- (id)init
{
	return [self initWithDict:nil];
}

- (id)initWithDict:(NSMutableDictionary *)dict
{
	if (self = [super init]) {
		if (dict) {
			mdict = dict;
		} else {
			mdict = [NSMutableDictionary dictionary];
		}
	}
	return self;
}

- (NSMutableDictionary *)dictionary
{
	return mdict;
}

- (NSString *)title
{
	return [mdict objectForKey:KEY_TITLE];
}

- (void)setTitle:(NSString *)title
{
	[mdict setObject:title forKey:KEY_TITLE];
}

- (BOOL)downloadMode
{
	return [[mdict objectForKey:KEY_DOWNLOADMODE] isEqualToString:@"true"];
}

- (void)setDownloadMode:(BOOL)downloadMode
{
	NSString* string = nil;
	if (downloadMode) {
		string = @"true";
	} else {
		string = @"false";
	}
	[mdict setObject:string forKey:KEY_DOWNLOADMODE];
}

- (NSString *)imagePathBase
{
    return [mdict objectForKey:KEY_IMAGEPATHBASE];
}

- (void)setImagePathBase:(NSString *)imagePathBase
{
    [mdict setObject:imagePathBase forKey:KEY_IMAGEPATHBASE];
}

- (NSMutableArray *)imageNames
{
	return [mdict objectForKey:KEY_IMAGENAMES];
}

- (void)setImageNames:(NSMutableArray *)imageNames
{
	[mdict setObject:imageNames forKey:KEY_IMAGENAMES];
}

- (BOOL)deletable
{
	return [[mdict objectForKey:KEY_DELETABLE] isEqualToString:@"true"];
}

- (void)setDeletable:(BOOL)deletable
{
	NSString* string = nil;
	if (deletable) {
		string = @"true";
	} else {
		string = @"false";
	}
	[mdict setObject:string forKey:KEY_DELETABLE];
}



@end
